using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using RetailAnalytic.Core;
using System.Drawing;
using Microsoft.AnalysisServices.AdomdClient;

namespace RetailAnalytic.Tools.SaveLocalCube
{
    class EntryPointServiceModule : RetailAnalytic.Core.IGlobalServiceModule
    {
        RetailAnalytic.Core.IMainShell MainShell;

        #region IGlobalServiceModule Members

        public void InitializeModule(IMainShell mainShell)
        {
            MainShell = mainShell;
        }

        public void ExecuteService(params object[] parameters)
        {
            try
            {
                FrmLocalCube FrmCube = new FrmLocalCube((AxMicrosoft.Office.Interop.Owc11.AxPivotTable)(parameters[1]), "Cube_name1", (AdomdConnection)(parameters[2]), (string)(parameters[3]));
                FrmCube.ShowDialog();
                FrmCube.BringToFront();
            }
            catch (Exception er)
            {
                Dialog.Show(Dialog_type.Error, SR.StringLibrary.GetStrMSG(SR.StringLibrary.KeyEnum.MESSAGE_EMPTY,
                    Environment.StackTrace, er));
            }
        }

        #endregion

        #region IModule Members
        public string Key { get { return "6d2318db-2146-439e-9b16-79a33621a409"; } }
        public string Name { get { return "SaveLocalCube"; } }
        public string Description { get { return "SaveLocalCube Service"; } }
        public string Version { get { return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); } }
        public string Author { get { return "SPotapov"; } }
        public string AssemblyName { get { return System.Reflection.Assembly.GetExecutingAssembly().GetName().FullName; } }
        public string OurFirm { get { return "IBS"; } }
        public Image Icon { get { return SR.ImagesLibrary.GetImageByName("adhook1"); } }
        public Image IconSelect { get { return SR.ImagesLibrary.GetImageByName("adhook1"); } }
        public Image ToolBarImage { get { return SR.ImagesLibrary.GetImageByName("adhook_32"); } }
        public string TitleDescription { get { return SR.StringLibrary.GetPresentationDescription(Name); } }
        public string ToolBarTitle { get { return SR.StringLibrary.GetTitlePresentation(Name); } }
        public bool HasChild { get { return false; } }
        #endregion
    }
}
